<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:email="http://saxonextensions.org/email">

  <xsl:param name="home"/>

	<!-- Configure SMTP output -->
  <xsl:output name="email"
              xmlns:email="http://saxonextensions.org/email"
              method="email:org.saxonextensions.eml.emitter.DevNullEmitter"
              indent="yes"
              encoding="ISO-8859-1" />

	<xsl:template match="/">
    <xsl:for-each select="rows/row">
      <xsl:result-document format="email" href="dev://null">
        <!-- set eMail Subject -->
        <email:Subject>Test</email:Subject>
        <!-- Set From address -->
        <email:From name="tester">test-source@test.com</email:From>
        <!-- Add couple of To addresses -->
        <email:To name="{concat(first_name,' ',last_name)}"><xsl:value-of select="email" /></email:To>
        <email:To name="John Tester Jr.">sampler@test.com</email:To>
        <!-- Add couple of CC addresses -->
        <email:Cc name="John CC 1st">sampler-CC-1@test.com</email:Cc>
        <email:Cc name="John CC 2nd">sampler-CC-2@test.com</email:Cc>
        <!-- Add couple of BCC addresses -->
        <email:Bcc name="John BCC 1st">sampler-BCC-1@test.com</email:Bcc>
        <email:Bcc name="John BCC 2nd">sampler-BCC-2@test.com</email:Bcc>

        <email:Part Content-Type="text/html">
          <html><body><h1>Test HTML part 1</h1></body></html>
        </email:Part>

        <email:Part Content-Type="text/html">
          <html><body><h1>Test HTML part 2</h1></body></html>
        </email:Part>

        <email:Part Content-Type="text/plain" email:Content-Disposition="">
          <html><body><h1>Test TEXT part 2</h1></body></html>
        </email:Part>

      </xsl:result-document>
    </xsl:for-each>    
  </xsl:template>

</xsl:stylesheet>